<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %> 
<script type="text/javascript">
function cm_showcpapp(id)
{
    var url = "mg/cpapp/show.do";
    var content = "model.id=" + id
                + "&model.cpid=" + document.getElementById("cp.id").value;
    var objectid = "cm_cpappdiv";
    sendXMLHttpRequest(url, content, objectid); 
}

function cm_showcpappproject(id)
{
    var url = "mg/cpapp/showproject.do";
    var content = "model.id=" + id
                + "&model.cpid=" + document.getElementById("cp.id").value;
    var objectid = "cm_cpappdiv";
    sendXMLHttpRequest(url, content, objectid); 
}
function cm_listcpapp(cpid)
{
	var url = "mg/cpapp/list.do";
    var objectid = "content";
    var content = "cp.id="+cpid;
    sendXMLHttpRequest(url, content, objectid); 
}
function cpapp_setdeployedonline(id,type)
{
    var url = "mg/cpapp/save.do?type=" + type;
    var objectid = "cpapp_status_"+id;
    var content = "model.id=" + id;
    sendXMLHttpRequest(url, content, objectid); 
}
function cm_listapppointofbilling(appnumber,cpid)
{
	var url = "mg/apppointofbilling/list.do";
    var objectid = "content";
    var content = "model.appnumber="+appnumber
    				+"&cpinfo.id="+cpid;
    sendXMLHttpRequest(url, content, objectid); 
}
function cm_listappsdk(appnumber,cpid)
{
	var url = "mg/appsdk/show.do";
    var objectid = "cm_cpappdiv";
    var content = "model.appnumber="+appnumber
    				+"&model.cpid="+cpid;
    sendXMLHttpRequest(url, content, objectid); 
}
function cm_listchannelapp(appnumber,cpid)
{
	var url = "mg/channelapp/list.do";
    var objectid = "content";
    var content = "cpapp.appnumber="+appnumber
    				+"&cp.id="+cpid;
    sendXMLHttpRequest(url, content, objectid); 
}
function cm_listappthreepay(appnumber,cpid)
{
	var url = "mg/appsdk/show.do";
    var objectid = "cm_cpappdiv";
    var content = "model.appnumber="+appnumber
    				+"&model.cpid="+cpid;
    sendXMLHttpRequest(url, content, objectid); 
}

</script>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="5"></td>
      </tr>
      <tr>
        <td height="25" class="t1">
          <img src="images/small0.gif" width="14" height="12"> 您现在的位置&gt;&gt;<a href="javascript:void(0);" title="返回cp管理" onclick="mg_listcp();">CP管理</a>&gt;&gt;应用管理</td>
      </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td >
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td height="25" class="table_blue">
          <input type="hidden" id="cp.id" name="cp.id" value="<s:property value="cp.id"/>">
          <strong><img src="images/dot.jpg" width="13" height="9">APP列表（CP：<s:property value="cp.id+' - '+cp.shortName"/>）</strong>
          <!--<span style="float:right;color:#000000;">        
          <button id="btn1" dojoType="dijit.form.Button" 
            onclick="cm_showcpapp(-1);">新增</button>
          &nbsp;&nbsp;
          </span>-->
          </td>
      </tr>   
      <tr>
      <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0"
           style="word-break:break-all;">
      <tr>
        <td align="center" class="table_g1" width="5%">ID</td>
        <td align="center" class="table_g2" width="35%">应用编号</td>
        <td align="center" class="table_g2" width="15%">应用名称</td>
        <td align="center" class="table_g2" width="10%">包名</td>
        <td align="center" class="table_g2" width="9%">版本</td>
        <td align="center" class="table_g2" width="10%">入口</td>
        <td align="center" class="table_g2" width="5%">状态</td>
        <td align="center" class="table_g2" width="21%"></td>
      </tr>
      
      <s:if test="list.size > 0" >
        <s:iterator value="list" status="stat">
        <tr class="trselect"> 
          <td class="table_w1" align="center"><s:property value="#stat.index+1" /></td>
          <td class="table_w2" align="center"><s:property value="appnumber" /></td>
          <td class="table_w2" align="center"><s:property value="appname" /></td>
          <td class="table_w2" align="center"><s:property value="apppackage" /></td>
          <td class="table_w2" align="center"><s:property value="appversion" /></td>
          <td class="table_w2" align="center"><s:property value="appentry" /></td>
          <td class="table_w2" align="center">
          <div id="cpapp_status_<s:property value="id"/>">
           <a href="javascript:void(0);" title="<s:if test="appstatus==0">点击下线</s:if><s:else>点击上线</s:else>" 
	                onclick="cpapp_setdeployedonline('<s:property value="id"/>', '<s:if test="appstatus==0">offline</s:if><s:else>online</s:else>');">
	                <s:property value="%{getConstantString('cpapp status',appstatus)}" /></a>
	      </div>
          </td>
          <td class="table_w2" align="center">
            <!--<a href="javascript:void(0);" 
              onclick="cm_showcpapp('<s:property value="id" />');">设置</a>
              &nbsp;&nbsp;-->
            <a href="javascript:void(0);" 
              onclick="cm_listapppointofbilling('<s:property value="appnumber" />','<s:property value="cp.id"/>');">计费点</a>
              &nbsp;
            <a href="javascript:void(0);" 
              onclick="cm_listchannelapp('<s:property value="appnumber" />','<s:property value="cp.id"/>');">渠道包</a>
            <a href="javascript:void(0);" 
              onclick="cm_listappsdk('<s:property value="appnumber" />','<s:property value="cp.id"/>');">SDK配置</a>
            <br />
            <a href="javascript:void(0);" 
              onclick="cm_listappthreepay('<s:property value="appnumber" />','<s:property value="cp.id"/>');">三方支付配置</a>
        </tr>    
        </s:iterator>
      </s:if>
      <s:else>
      <tr>
        <td class="table_w1" align="center" colspan="8">无</td>
      </tr>
      </s:else>
      </table>
      </td>
      </tr>
      <tr>
        <td align="center" class="table_w1">
            <button id="btnBack" dojoType="dijit.form.Button"  
                onclick="mg_listcp();">返回</button>
        </td>          
      </tr>
      <tr> 
        <td background="images/table_bom_bg.jpg">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
              <img src="images/table_bom_left.jpg" width="20" height="15"></td>
            <td></td>
            <td align="right">
              <img src="images/table_bom_right.jpg" width="20" height="15"></td>
          </tr>
          </table>
        </td>
      </tr>
    </table>  
  </td>
  <td width="5"></td>
  </tr>
  </table>
  <div id="cm_cpappdiv"></div>  